home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / BCCollec / Structs / Collects / BCCollD.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  2.0 KB  |  69 lines  |  [TEXT/MPS ]

  1. //  The C++ Booch Components (Version 2.1)
  2. //  (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
  3. //
  4. //  BCCollD.h
  5. //
  6. //  This file contains the declaration of the dynamic collection.
  7.  
  8. #ifndef BCCOLLD_H
  9. #define BCCOLLD_H 1
  10.  
  11. #include "BCDynami.h"
  12. #include "BCColl.h"
  13.  
  14. // Dynamic collection
  15.  
  16. template<class Item, class StorageManager>
  17. class BC_TDynamicCollection : public BC_TCollection<Item> {
  18. public:
  19.  
  20.   BC_TDynamicCollection();
  21.   BC_TDynamicCollection(BC_Index chunkSize);
  22.   BC_TDynamicCollection(const BC_TDynamicCollection<Item, StorageManager>&);
  23.   virtual ~BC_TDynamicCollection();
  24.  
  25.   virtual BC_TCollection<Item>& operator=(const BC_TCollection<Item>&);
  26.   virtual BC_TCollection<Item>&
  27.     operator=(const BC_TDynamicCollection<Item, StorageManager>&);
  28.   virtual BC_Boolean operator==(const BC_TCollection<Item>&) const;
  29.   virtual BC_Boolean
  30.     operator==(const BC_TDynamicCollection<Item, StorageManager>&) const;
  31.   BC_Boolean operator!=(const BC_TDynamicCollection<Item, StorageManager>&) const;
  32.   virtual const Item& operator[](BC_Index) const;
  33.   virtual Item& operator[](BC_Index);
  34.  
  35.   virtual void SetChunkSize(BC_Index chunkSize);
  36.   virtual void Preallocate(BC_Index new_length);
  37.   virtual void Clear();
  38.   virtual void Insert(const Item&);
  39.   virtual void Insert(const Item&, BC_Index before);
  40.   virtual void Append(const Item&);
  41.   virtual void Append(const Item&, BC_Index after);
  42.   virtual void Remove(BC_Index at);
  43.   virtual void Replace(BC_Index at, const Item&);
  44.  
  45.   virtual BC_Index ChunkSize() const;
  46.   virtual BC_Index Length() const;
  47.   virtual BC_Boolean IsEmpty() const;
  48.   virtual const Item& First() const;
  49.   virtual Item& First();
  50.   virtual const Item& Last() const;
  51.   virtual Item& Last();
  52.   virtual BC_ExtendedIndex Location(const Item&) const;
  53.  
  54.   static void* operator new(size_t);
  55.   static void operator delete(void*, size_t);
  56.  
  57. protected:
  58.  
  59.   BC_TDynamic<Item, StorageManager> fRep;
  60.  
  61.   virtual void Purge();
  62.   virtual void Add(const Item&);
  63.   virtual BC_Index Cardinality() const;
  64.   virtual const Item& ItemAt(BC_Index) const;
  65.  
  66. };
  67.  
  68. #endif
  69.